package com.cf.conf.core;

import com.cf.util.ObjectJsonUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * game-server-UpdateListener
 *
 * @author <a href="2428922347@qq.com">Zhu mingming</a>
 * @info
 * @since 2018/6/8 下午 04:28
 */
@Slf4j
public class UpdateListener {

    @Autowired
    private PropertyManager propertyManager;



    public void listen(String msg) {
        try {
            UpdateMsg updateMsg = ObjectJsonUtil.toObject(msg, UpdateMsg.class);
            propertyManager.updateValue(updateMsg.getApp(), updateMsg.getProfile(), updateMsg.getKey(), updateMsg.getValue());
        } catch (Exception error) {
            log.error("更新属性异常！", error);
        }

    }

}
